<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFormBuilder Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFormBuilder Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1><p>The QFormBuilder class is used to dynamically construct user
interfaces from UI files at run-time. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractformbuilder.html">QAbstractFormBuilder</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qformbuilder.html#QFormBuilder">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qformbuilder.html#addPluginPath">addPluginPath</a></b> (<i>self</i>, QString&#160;<i>pluginPath</i>)</li><li><div class="fn" /><b><a href="qformbuilder.html#clearPluginPaths">clearPluginPaths</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QDesignerCustomWidgetInterface <b><a href="qformbuilder.html#customWidgets">customWidgets</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qformbuilder.html#pluginPaths">pluginPaths</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qformbuilder.html#setPluginPath">setPluginPath</a></b> (<i>self</i>, QStringList&#160;<i>pluginPaths</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFormBuilder class is used to dynamically construct user
interfaces from UI files at run-time.</p>
<p>The QFormBuilder class provides a mechanism for dynamically
creating user interfaces at run-time, based on UI files created
with <i>Qt Designer</i>. For example:</p>
<pre class="cpp">
         MyForm<span class="operator">.</span>MyForm(<span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent)
             : <span class="type"><a href="qwidget.html">QWidget</a></span>(parent)
         {
             <span class="type">QFormBuilder</span> builder;
             <span class="type"><a href="qfile.html">QFile</a></span> file(<span class="string">":/forms/myWidget.ui"</span>);
             file<span class="operator">.</span>open(<span class="type"><a href="qfile.html">QFile</a></span><span class="operator">.</span>ReadOnly);
             <span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>myWidget <span class="operator">=</span> builder<span class="operator">.</span>load(<span class="operator">&amp;</span>file<span class="operator">,</span> <span class="keyword">this</span>);
             file<span class="operator">.</span>close();

             <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span> <span class="operator">*</span>layout <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qvboxlayout.html">QVBoxLayout</a></span>;
             layout<span class="operator">-</span><span class="operator">&gt;</span>addWidget(myWidget);
             setLayout(layout);
         }
</pre>
<p>By including the user interface in the example's resources
(<tt>myForm.qrc</tt>), we ensure that it will be present when the
example is run:</p>
<pre class="cpp">
     <span class="operator">&lt;</span><span class="operator">!</span>DOCTYPE RCC<span class="operator">&gt;</span><span class="operator">&lt;</span>RCC version<span class="operator">=</span><span class="string">"1.0"</span><span class="operator">&gt;</span>
     <span class="operator">&lt;</span>qresource prefix<span class="operator">=</span><span class="string">"/forms"</span><span class="operator">&gt;</span>
        <span class="operator">&lt;</span>file<span class="operator">&gt;</span>mywidget<span class="operator">.</span>ui<span class="operator">&lt;</span><span class="operator">/</span>file<span class="operator">&gt;</span>
     <span class="operator">&lt;</span><span class="operator">/</span>qresource<span class="operator">&gt;</span>
     <span class="operator">&lt;</span><span class="operator">/</span>RCC<span class="operator">&gt;</span>
</pre>
<p>QFormBuilder extends the <a href="qabstractformbuilder.html">QAbstractFormBuilder</a> base class
with a number of functions that are used to support custom widget
plugins:</p>
<ul>
<li><a href="qformbuilder.html#pluginPaths">pluginPaths</a>()
returns the list of paths that the form builder searches when
loading custom widget plugins.</li>
<li><a href="qformbuilder.html#addPluginPath">addPluginPath</a>()
allows additional paths to be registered with the form
builder.</li>
<li><a href="qformbuilder.html#setPluginPath">setPluginPath</a>()
is used to replace the existing list of paths with a list obtained
from some other source.</li>
<li><a href="qformbuilder.html#clearPluginPaths">clearPluginPaths</a>() removes
all paths registered with the form builder.</li>
<li><a href="qformbuilder.html#customWidgets">customWidgets</a>()
returns a list of interfaces to plugins that can be used to create
new instances of registered custom widgets.</li>
</ul>
<p>The QFormBuilder class is typically used by custom components
and applications that embed <i>Qt Designer</i>. Standalone
applications that need to dynamically generate user interfaces at
run-time use the <a href="quiloader.html">QUiLoader</a> class,
found in the <a href="qtuitools.html">QtUiTools</a> module.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFormBuilder" />QFormBuilder.__init__ (<i>self</i>)</h3><p>Constructs a new form builder.</p>


<h3 class="fn"><a name="addPluginPath" />QFormBuilder.addPluginPath (<i>self</i>, QString&#160;<i>pluginPath</i>)</h3><p>Adds a new plugin path specified by <i>pluginPath</i> to the
list of paths that will be searched by the form builder when
loading a custom widget plugin.</p>
<p><b>See also</b> <a href="qformbuilder.html#setPluginPath">setPluginPath</a>() and <a href="qformbuilder.html#clearPluginPaths">clearPluginPaths</a>().</p>


<h3 class="fn"><a name="clearPluginPaths" />QFormBuilder.clearPluginPaths (<i>self</i>)</h3><p>Clears the list of paths that the form builder uses to search
for custom widget plugins.</p>
<p><b>See also</b> <a href="qformbuilder.html#pluginPaths">pluginPaths</a>().</p>


<h3 class="fn"><a name="customWidgets" />list-of-QDesignerCustomWidgetInterface QFormBuilder.customWidgets (<i>self</i>)</h3><p>Returns a list of the available plugins.</p>


<h3 class="fn"><a name="pluginPaths" />QStringList QFormBuilder.pluginPaths (<i>self</i>)</h3><p>Returns the list of paths the form builder searches for
plugins.</p>
<p><b>See also</b> <a href="qformbuilder.html#addPluginPath">addPluginPath</a>().</p>


<h3 class="fn"><a name="setPluginPath" />QFormBuilder.setPluginPath (<i>self</i>, QStringList&#160;<i>pluginPaths</i>)</h3><p>Sets the list of plugin paths to the list specified by
<i>pluginPaths</i>.</p>
<p><b>See also</b> <a href="qformbuilder.html#addPluginPath">addPluginPath</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>